package cn.tedu.csmall.stock.webapi.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

@Repository
public interface StockMapper {

    @Insert("update stock_tbl set count=count-#{reduceCount} " +
            "where commodity_code=#{commodityCode} and count>=#{reduceCount}")
    void updateStockCountByCommodityCode(@Param("commodityCode") String commodityCode,
                                         @Param("reduceCount") Integer reduceCount);
}
